const yaml = require('js-yaml');
const fs = require('fs');
const path = require('path');
const logger = require('../logger');

exports.getConfig = function getConfig() {
// Get document, or throw exception on error
  try {
    return yaml.load(fs.readFileSync(path.join(process.cwd(), 'config.yml'), 'utf8'));
  }
  catch (e) {
    logger.error(e);
    return null;
  }
};

exports.sleep = function sleep(ms = 1000) {
  return new Promise((resolve) => {
    setTimeout(() => resolve(true), ms);
  });
};
